/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.indragunawan.simtrans;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Prima
 */
@Entity
@Table(name = "users", catalog = "simtrans", schema = "")
@NamedQueries({
    @NamedQuery(name = "Users.findAll", query = "SELECT u FROM Users u"),
    @NamedQuery(name = "Users.findByIdUsers", query = "SELECT u FROM Users u WHERE u.idUsers = :idUsers"),
    @NamedQuery(name = "Users.findByLogin", query = "SELECT u FROM Users u WHERE u.login = :login"),
    @NamedQuery(name = "Users.findByPassword", query = "SELECT u FROM Users u WHERE u.password = :password"),
    @NamedQuery(name = "Users.findByNama", query = "SELECT u FROM Users u WHERE u.nama = :nama"),
    @NamedQuery(name = "Users.findByAlamat", query = "SELECT u FROM Users u WHERE u.alamat = :alamat"),
    @NamedQuery(name = "Users.findByKota", query = "SELECT u FROM Users u WHERE u.kota = :kota"),
    @NamedQuery(name = "Users.findByPropinsi", query = "SELECT u FROM Users u WHERE u.propinsi = :propinsi"),
    @NamedQuery(name = "Users.findByNegara", query = "SELECT u FROM Users u WHERE u.negara = :negara"),
    @NamedQuery(name = "Users.findByTelepon", query = "SELECT u FROM Users u WHERE u.telepon = :telepon"),
    @NamedQuery(name = "Users.findByHp", query = "SELECT u FROM Users u WHERE u.hp = :hp"),
    @NamedQuery(name = "Users.findByEmail", query = "SELECT u FROM Users u WHERE u.email = :email"),
    @NamedQuery(name = "Users.findByWebsite", query = "SELECT u FROM Users u WHERE u.website = :website")})
public class Users implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idUsers")
    private Integer idUsers;
    @Basic(optional = false)
    @Column(name = "login")
    private String login;
    @Basic(optional = false)
    @Column(name = "password")
    private String password;
    @Column(name = "nama")
    private String nama;
    @Column(name = "alamat")
    private String alamat;
    @Column(name = "kota")
    private String kota;
    @Column(name = "propinsi")
    private String propinsi;
    @Column(name = "negara")
    private String negara;
    @Column(name = "telepon")
    private String telepon;
    @Column(name = "hp")
    private String hp;
    @Column(name = "email")
    private String email;
    @Column(name = "website")
    private String website;

    public Users() {
    }

    public Users(Integer idUsers) {
        this.idUsers = idUsers;
    }

    public Users(Integer idUsers, String login, String password) {
        this.idUsers = idUsers;
        this.login = login;
        this.password = password;
    }

    public Integer getIdUsers() {
        return idUsers;
    }

    public void setIdUsers(Integer idUsers) {
        Integer oldIdUsers = this.idUsers;
        this.idUsers = idUsers;
        changeSupport.firePropertyChange("idUsers", oldIdUsers, idUsers);
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        String oldLogin = this.login;
        this.login = login;
        changeSupport.firePropertyChange("login", oldLogin, login);
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        String oldPassword = this.password;
        this.password = password;
        changeSupport.firePropertyChange("password", oldPassword, password);
    }

    public String getNama() {
        return nama;
    }

    public void setNama(String nama) {
        String oldNama = this.nama;
        this.nama = nama;
        changeSupport.firePropertyChange("nama", oldNama, nama);
    }

    public String getAlamat() {
        return alamat;
    }

    public void setAlamat(String alamat) {
        String oldAlamat = this.alamat;
        this.alamat = alamat;
        changeSupport.firePropertyChange("alamat", oldAlamat, alamat);
    }

    public String getKota() {
        return kota;
    }

    public void setKota(String kota) {
        String oldKota = this.kota;
        this.kota = kota;
        changeSupport.firePropertyChange("kota", oldKota, kota);
    }

    public String getPropinsi() {
        return propinsi;
    }

    public void setPropinsi(String propinsi) {
        String oldPropinsi = this.propinsi;
        this.propinsi = propinsi;
        changeSupport.firePropertyChange("propinsi", oldPropinsi, propinsi);
    }

    public String getNegara() {
        return negara;
    }

    public void setNegara(String negara) {
        String oldNegara = this.negara;
        this.negara = negara;
        changeSupport.firePropertyChange("negara", oldNegara, negara);
    }

    public String getTelepon() {
        return telepon;
    }

    public void setTelepon(String telepon) {
        String oldTelepon = this.telepon;
        this.telepon = telepon;
        changeSupport.firePropertyChange("telepon", oldTelepon, telepon);
    }

    public String getHp() {
        return hp;
    }

    public void setHp(String hp) {
        String oldHp = this.hp;
        this.hp = hp;
        changeSupport.firePropertyChange("hp", oldHp, hp);
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        String oldEmail = this.email;
        this.email = email;
        changeSupport.firePropertyChange("email", oldEmail, email);
    }

    public String getWebsite() {
        return website;
    }

    public void setWebsite(String website) {
        String oldWebsite = this.website;
        this.website = website;
        changeSupport.firePropertyChange("website", oldWebsite, website);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idUsers != null ? idUsers.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Users)) {
            return false;
        }
        Users other = (Users) object;
        if ((this.idUsers == null && other.idUsers != null) || (this.idUsers != null && !this.idUsers.equals(other.idUsers))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.indragunawan.simtrans.Users[idUsers=" + idUsers + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
